#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
int n,m1,m2,k,ans;
int fa[110000],fb[110000];
struct node{
	ll c,l;
	int f;
}a[110000],b[110000];
int cmp(node x,node y){
	return x.c<y.c;
}
ll read(){
	char c=getchar();
	ll num=0;
	while('0'>c||c>'9')c=getchar();
	while('0'<=c&&c<='9'){
		num=num*10+c-'0';
		c=getchar();
	}
	return num;
}
int main(){
	freopen("airport.in","r",stdin);
	freopen("airport.out","w",stdout);
	n=read();
	m1=read();
	m2=read();
	for(int i=1;i<=m1;i++){
		a[i].f=0;
		a[i].c=read();
		a[i].l=read();
	}
	for(int i=1;i<=m2;i++){
		b[i].f=0;
		b[i].c=read();
		b[i].l=read();
	}//read
	sort(a+1,a+1+m1,cmp);
	sort(b+1,b+1+m2,cmp);
	
	fa[2]=fb[n]=1;
	k=1;a[k].f=1;
	for(int i=2;i<=m1;i++){
		if(a[k].l<a[i].c){
			k=i;
			a[i].f=1;
			fa[2]++;
		}
	}
	k=1;b[k].f=1;
	for(int i=2;i<=m2;i++){
		if(b[k].l<b[i].c){
			fb[n]++;
			k=i;
			b[i].f=1;
		}
	}
	for(int i=3;i<=n+1;i++){
		fa[i]=fa[i-1];
		if(fa[i]==m1)continue;
		for(int j=1;j<=m1;j++){
			if(a[j-1].f&&(!a[j].f)&&(a[j-1].f!=i)){
				fa[i]++;
				k=j;
				a[j].f=i;
				for(int s=j+1;(!a[s].f)&&s<=m1;s++){
					if(a[k].l<a[s].c){
						k=s;
						a[k].f=i;
						fa[i]++;
					}
				}
			}
		}
	}
	for(int i=n-1;i>=1;i--){
		fb[i]=fb[i+1];
		if(fb[i]==m2)continue;
		for(int j=1;j<=m2;j++){
			if(b[j-1].f&&(!b[j].f)&&b[j-1].f!=i){
				k=j;
				fb[i]++;
				b[j].f=i;
				for(int s=j+1;(!b[s].f)&&s<=m2;s++){
					if(b[k].l<b[s].c){
						k=s;
						b[k].f=i;
						fb[i]++;
					}
				}
			}
		}
	}
	for(int i=1;i<=n+1;i++)ans=max(ans,fa[i]+fb[i]);
	cout<<ans;
	fclose(stdin);
	fclose(stdout);
	return 0;
}
